package demo

import scala.io.StdIn

object Demo2 {
  //高阶函数标准形式
  //  def sum(num1:Int)={
  //    def big(num2:Int)=if(num1>num2)num1 else num2
  //    big _
  //  }

  //高阶函数柯里化
  //def big(n1:Int)(n2:Int)=if(n1>n2) n1 else n2


  def calc(n1: Int, n2: Int, fun: (Int, Int) => Int) = fun(n1, n2)


  def main(args: Array[String]): Unit = {
    var n1 = StdIn.readInt();
    //var res = sum(n1)
    var n2 = StdIn.readInt()

    println(calc(n1, n2, (x, y) => x + y))
    //println(big(n1)(n2))
    //println(res(n2))

  }


}

